
// <copyright file="DbCallbackStrategy.cs" company="Subhadra Software Solutions">
//   
// </copyright>
// <summary>
//   This class is an implementation of IDbCallbackStrategy{T}.
// </summary>

namespace SubhadraSolutions.Sharp.Utils.Data
{
    /// <summary>
    /// This class is an implementation of IDbCallbackStrategy{T}.
    /// </summary>
    /// <typeparam name="T">
    /// </typeparam>
    public sealed class DbCallbackStrategy<T> : IDbCallbackStrategy<T>
    {
        #region Constructors and Finalizers

        /// <summary>
        /// Initializes a new instance of the <see cref="DbCallbackStrategy{T}"/> class.
        /// </summary>
        /// <param name="executeAsReader">
        /// if set to <c>true</c> [execute asynchronous reader].
        /// </param>
        /// <param name="initializeCommand">
        /// The initialize command.
        /// </param>
        /// <param name="beforeExecute">
        /// The before execute.
        /// </param>
        /// <param name="afterExecute">
        /// The after execute.
        /// </param>
        public DbCallbackStrategy(bool executeAsReader, InitializeCommandDelegate initializeCommand, BeforeExecuteDelegate<T> beforeExecute, AfterExecuteDelegate<T> afterExecute = null)
        {
            this.ExecuteAsReader = executeAsReader;
            this.InitializeCommand = initializeCommand;
            this.BeforeExecute = beforeExecute;
            this.AfterExecute = afterExecute;
        }

        #endregion Constructors and Finalizers

        #region Public Properties

        /// <summary>
        ///     Gets the after execute.
        /// </summary>
        /// <value>The after execute.</value>
        public AfterExecuteDelegate<T> AfterExecute { get; private set; }

        /// <summary>
        ///     Gets the before execute.
        /// </summary>
        /// <value>The before execute.</value>
        public BeforeExecuteDelegate<T> BeforeExecute { get; private set; }

        /// <summary>
        /// Gets or sets a value indicating whether [execute asynchronous reader].
        /// </summary>
        /// <value>
        /// <c>true</c> if [execute asynchronous reader]; otherwise, <c>false</c>.
        /// </value>
        public bool ExecuteAsReader { get; private set; }

        /// <summary>
        ///     Gets the initialize command.
        /// </summary>
        /// <value>The initialize command.</value>
        public InitializeCommandDelegate InitializeCommand { get; private set; }

        #endregion Public Properties
    }
}